# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Solar.V1.Model.FinancialAnalysis do
  @moduledoc """
  Analysis of the cost and benefits of the optimum solar layout for a particular electric bill size.

  ## Attributes

  *   `averageKwhPerMonth` (*type:* `number()`, *default:* `nil`) - How much electricity the house uses in an average month, based on the bill size and the local electricity rates.
  *   `cashPurchaseSavings` (*type:* `GoogleApi.Solar.V1.Model.CashPurchaseSavings.t`, *default:* `nil`) - Cost and benefit of buying the solar panels with cash.
  *   `defaultBill` (*type:* `boolean()`, *default:* `nil`) - Whether this is the bill size selected to be the default bill for the area this building is in. Exactly one `FinancialAnalysis` in `BuildingSolarPotential` should have `default_bill` set.
  *   `financedPurchaseSavings` (*type:* `GoogleApi.Solar.V1.Model.FinancedPurchaseSavings.t`, *default:* `nil`) - Cost and benefit of buying the solar panels by financing the purchase.
  *   `financialDetails` (*type:* `GoogleApi.Solar.V1.Model.FinancialDetails.t`, *default:* `nil`) - Financial information that applies regardless of the financing method used.
  *   `leasingSavings` (*type:* `GoogleApi.Solar.V1.Model.LeasingSavings.t`, *default:* `nil`) - Cost and benefit of leasing the solar panels.
  *   `monthlyBill` (*type:* `GoogleApi.Solar.V1.Model.Money.t`, *default:* `nil`) - The monthly electric bill this analysis assumes.
  *   `panelConfigIndex` (*type:* `integer()`, *default:* `nil`) - Index in solar_panel_configs of the optimum solar layout for this bill size. This can be -1 indicating that there is no layout. In this case, the remaining submessages will be omitted.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :averageKwhPerMonth => number() | nil,
          :cashPurchaseSavings => GoogleApi.Solar.V1.Model.CashPurchaseSavings.t() | nil,
          :defaultBill => boolean() | nil,
          :financedPurchaseSavings => GoogleApi.Solar.V1.Model.FinancedPurchaseSavings.t() | nil,
          :financialDetails => GoogleApi.Solar.V1.Model.FinancialDetails.t() | nil,
          :leasingSavings => GoogleApi.Solar.V1.Model.LeasingSavings.t() | nil,
          :monthlyBill => GoogleApi.Solar.V1.Model.Money.t() | nil,
          :panelConfigIndex => integer() | nil
        }

  field(:averageKwhPerMonth)
  field(:cashPurchaseSavings, as: GoogleApi.Solar.V1.Model.CashPurchaseSavings)
  field(:defaultBill)
  field(:financedPurchaseSavings, as: GoogleApi.Solar.V1.Model.FinancedPurchaseSavings)
  field(:financialDetails, as: GoogleApi.Solar.V1.Model.FinancialDetails)
  field(:leasingSavings, as: GoogleApi.Solar.V1.Model.LeasingSavings)
  field(:monthlyBill, as: GoogleApi.Solar.V1.Model.Money)
  field(:panelConfigIndex)
end

defimpl Poison.Decoder, for: GoogleApi.Solar.V1.Model.FinancialAnalysis do
  def decode(value, options) do
    GoogleApi.Solar.V1.Model.FinancialAnalysis.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Solar.V1.Model.FinancialAnalysis do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
